//
//  SimpleAcionSheetCell.m
//  RSW.IOS
//
//  Created by zhaiqiuqiu on 17/1/4.
//  Copyright © 2017年 com.xtion.crm. All rights reserved.
//

#import "SimpleAcionSheetCell.h"

@interface SimpleAcionSheetCell()
{
    HeadImageView *_headImageView;
    UILabel *_titleLabel;
}
@end

@implementation SimpleAcionSheetCell

-(instancetype)init
{
    return [self initWithFrame:CGRectZero];
}

-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    
    _headImageView = [[HeadImageView alloc]initWithFrame:CGRectMake(10,10, 40, 40)];
    [self.contentView addSubview:_headImageView];
    
    _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(_headImageView.right + 10, 0, 0, 20)];
    [self.contentView addSubview:_titleLabel];
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    CGFloat width = self.contentView.width - 10 - _headImageView.width - 10 - 10;
    _titleLabel.width = width;
    _titleLabel.centerY = self.contentView.height/2;
}

- (void)setHeadImage:(UIImage *)headImage
{
    _headImageView.headImage = headImage;
}

- (void)setTitle:(NSString *)title
{
    _titleLabel.text = title;
}
@end
